#ifndef __REDCELL_WRAPPER_HPP__
#define __REDCELL_WRAPPER_HPP__

#include "common.hpp"

struct StringWriterImpl;
struct StringReaderImpl;

struct StringWriter {
  StringWriterImpl *impl;

  StringWriter();
  ~StringWriter();

  void putKeySkip(const size_t val);

#if REDCELL_STRINGKEYS
  void putStrKey(const redcell::StrKey &val);
#endif

  void putNil();
  void putInteger(const redcell::Integer val);
  void putReal(const redcell::Real val);
  void putString(const redcell::String &val);
  void putEmptySub();
  void putSub();
  void putEnd();

  redcell::String str() const;
};


struct StringReader {
  StringReaderImpl *impl;

  StringReader(const redcell::String raw);
  ~StringReader();

  unsigned char getFlag() throw (redcell::MarshalError);
  redcell::Integer getInteger(const int sign) throw (redcell::MarshalError);
  redcell::Real getFloat() throw (redcell::MarshalError);
  redcell::Real getDouble() throw (redcell::MarshalError);
  redcell::String getString() throw (redcell::MarshalError);
};

#endif
